package com.sugar.real.estate.module.business.controller.admin.apartment.vo;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
import com.sugar.real.estate.framework.excel.core.annotations.DictFormat;
import com.sugar.real.estate.framework.excel.core.convert.DictConvert;
import com.sugar.real.estate.module.business.config.convert.ListToStringConverter;
import com.sugar.real.estate.module.business.config.convert.UrlsStrImageConverter;
import com.sugar.real.estate.module.infra.enums.DictTypeConstants;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;

@Schema(description = "管理后台 - 楼盘/公寓 Response VO")
@Data
@ExcelIgnoreUnannotated
public class ApartmentRespVO {

    @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "19864")
    @ExcelProperty("主键")
    private Long id;

    @Schema(description = "房屋中文名", requiredMode = Schema.RequiredMode.REQUIRED)
    @ExcelProperty("房屋中文名")
    private String nameZhCn;

    @Schema(description = "房屋英文名", requiredMode = Schema.RequiredMode.REQUIRED)
    @ExcelProperty("房屋英文名")
    private String nameEnUs;

    @Schema(description = "浏览量", requiredMode = Schema.RequiredMode.REQUIRED)
    @ExcelProperty(value = "浏览量")
    private Long lookCount;

    @Schema(description = "关注数", requiredMode = Schema.RequiredMode.REQUIRED)
    @ExcelProperty(value = "关注数")
    private Long followCount;

    @Schema(description = "咨询数", requiredMode = Schema.RequiredMode.REQUIRED)
    @ExcelProperty(value = "咨询数")
    private Long consultCount;

    @Schema(description = "房屋图片（多个逗号分隔）", requiredMode = Schema.RequiredMode.REQUIRED)
    @ExcelProperty(value = "房屋图片", converter = UrlsStrImageConverter.class)
    private List<String> showImages;

    @Schema(description = "热门推荐", requiredMode = Schema.RequiredMode.REQUIRED)
    @ExcelProperty(value = "热门推荐", converter = DictConvert.class)
    @DictFormat(DictTypeConstants.BOOLEAN_STRING)
    private Boolean isHot;

    @Schema(description = "最新楼盘", requiredMode = Schema.RequiredMode.REQUIRED)
    @ExcelProperty(value = "最新楼盘", converter = DictConvert.class)
    @DictFormat(DictTypeConstants.BOOLEAN_STRING)
    private Boolean isLatest;

    /*@Schema(description = "主力户型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
    @ExcelProperty("主力户型")
    private String mainHouseType;*/
    /**
     * 主力户型
     */
    @ExcelProperty("主力户型中文")
    private String mainHouseTypeZhCn;
    /**
     * 主力户型
     */
    @ExcelProperty("主力户型英文")
    private String mainHouseTypeEnUs;

    @Schema(description = "最小价格（单位：元）")
    @ExcelProperty("最小价格")
    private BigDecimal priceMin;

    @Schema(description = "最大价格（单位：元）")
    @ExcelProperty("最大价格")
    private BigDecimal priceMax;

    @Schema(description = "中文标签（多个逗号分隔）", requiredMode = Schema.RequiredMode.REQUIRED)
    @ExcelProperty(value = "中文标签", converter = ListToStringConverter.class)
    private List<String> tagsZhCn;

    @Schema(description = "英文标签（多个逗号分隔）", requiredMode = Schema.RequiredMode.REQUIRED)
    @ExcelProperty(value = "英文标签", converter = ListToStringConverter.class)
    private List<String> tagsEnUs;

    @Schema(description = "中文亮点（多个逗号分隔）", requiredMode = Schema.RequiredMode.REQUIRED)
    @ExcelProperty(value = "中文亮点", converter = ListToStringConverter.class)
    private List<String> projectLightZhCn;

    @Schema(description = "英文亮点（多个逗号分隔）", requiredMode = Schema.RequiredMode.REQUIRED)
    @ExcelProperty(value = "英文亮点", converter = ListToStringConverter.class)
    private List<String> projectLightEnUs;

    @Schema(description = "项目类型（字典：2）", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
    @ExcelProperty("项目类型")
    private String projectType;

    @Schema(description = "项目进度（中文）", requiredMode = Schema.RequiredMode.REQUIRED)
    @ExcelProperty("项目进度（中文）")
    private String projectProgressZhCn;

    @Schema(description = "项目进度（英文）", requiredMode = Schema.RequiredMode.REQUIRED)
    @ExcelProperty("项目进度（英文）")
    private String projectProgressEnUs;

    @Schema(description = "完工时间", requiredMode = Schema.RequiredMode.REQUIRED)
    @ExcelProperty("完工时间")
    @JsonSerialize(using = LocalDateSerializer.class) // 序列化（响应）
    @JsonDeserialize(using = LocalDateDeserializer.class) // 反序列化（请求）
    @JsonFormat(pattern = "yyyy-MM-dd")
    private LocalDate completionTime;

    @Schema(description = "建筑商中文名", requiredMode = Schema.RequiredMode.REQUIRED)
    @ExcelProperty("建筑商中文名")
    private String builderZhCn;

    @Schema(description = "建筑商英文名", requiredMode = Schema.RequiredMode.REQUIRED)
    @ExcelProperty("建筑商英文名")
    private String builderEnUs;

    @Schema(description = "设计师中文名", requiredMode = Schema.RequiredMode.REQUIRED)
    @ExcelProperty("设计师中文名")
    private String designerZhCn;

    @Schema(description = "设计师英文名", requiredMode = Schema.RequiredMode.REQUIRED)
    @ExcelProperty("设计师英文名")
    private String designerEnUs;

    @Schema(description = "内容中文详情", requiredMode = Schema.RequiredMode.REQUIRED)
    @ExcelProperty("内容中文详情")
    private String contentZhCn;

    @Schema(description = "内容英文详情", requiredMode = Schema.RequiredMode.REQUIRED)
    @ExcelProperty("内容英文详情")
    private String contentEnUs;

    @Schema(description = "所属省份ID", example = "28443")
    @ExcelIgnore
    private Long provinceId;

    @Schema(description = "所属市ID", example = "17702")
    @ExcelIgnore
    private Long cityId;

    @Schema(description = "所属区县ID", example = "1985")
    @ExcelIgnore
    private Long countyId;

    @Schema(description = "省市区Ids", requiredMode = Schema.RequiredMode.REQUIRED)
    @ExcelIgnore
    private List<Long> locationIds;

    @Schema(description = "关联的资讯ID", requiredMode = Schema.RequiredMode.REQUIRED)
    @ExcelIgnore
    private List<Long> infoIds;

    @Schema(description = "坐标点（经纬度逗号分隔）", requiredMode = Schema.RequiredMode.REQUIRED)
    @ExcelProperty("坐标点")
    private String point;

    @Schema(description = "定位详情", requiredMode = Schema.RequiredMode.REQUIRED)
    @ExcelProperty("定位详情")
    private String pointDetail;

    @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
    @ExcelProperty("创建时间")
    private LocalDateTime createTime;

    @Schema(description = "房屋视频（多个逗号分隔）", requiredMode = Schema.RequiredMode.REQUIRED)
    @ExcelProperty(value = "房屋视频", converter = ListToStringConverter.class)
    private List<String> showVideos;

    @Schema(description = "上下架（0下架 1上架）", requiredMode = Schema.RequiredMode.REQUIRED)
    private Boolean isShow;

    @Schema(description = "参考总价", requiredMode = Schema.RequiredMode.REQUIRED)
    private String totalAmount;
}